{
 "metadata": {
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5-final"
  },
  "orig_nbformat": 2,
  "kernelspec": {
   "name": "python3",
   "display_name": "Python 3",
   "language": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2,
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "{电影,1&&连续剧,2&&综艺,3&&动漫,4&&动作片,6&&喜剧片,7&&爱情片,8&&科幻片,9&&恐怖片,10&&剧情片,11&&战争片,12&&国产剧,13&&港台剧,14&&日韩剧,15&&欧美剧,16&&纪录片,20&&惊悚片,21&&悬疑片,22&&灾难片,23&&海外剧,24&&动画片,25&&武侠片,26&&国产动漫,27&&日韩动漫,28&&欧美动漫,29&&港台动漫,30&&海外动漫,31&&大陆综艺,32&&港台综艺,33&&日韩综艺,34&&欧美综艺,35&&海外综艺,36&&犯罪片,37&&伦理片,38}\n"
     ]
    }
   ],
   "source": [
    "import re\n",
    "# wpcm解析网址\n",
    "urt='<class><ty id=\"1\">电影</ty><ty id=\"2\">连续剧</ty><ty id=\"3\">综艺</ty><ty id=\"4\">动漫</ty><ty id=\"6\">动作片</ty><ty id=\"7\">喜剧片</ty><ty id=\"8\">爱情片</ty><ty id=\"9\">科幻片</ty><ty id=\"10\">恐怖片</ty><ty id=\"11\">剧情片</ty><ty id=\"12\">战争片</ty><ty id=\"13\">国产剧</ty><ty id=\"14\">港台剧</ty><ty id=\"15\">日韩剧</ty><ty id=\"16\">欧美剧</ty><ty id=\"20\">纪录片</ty><ty id=\"21\">惊悚片</ty><ty id=\"22\">悬疑片</ty><ty id=\"23\">灾难片</ty><ty id=\"24\">海外剧</ty><ty id=\"25\">动画片</ty><ty id=\"26\">武侠片</ty><ty id=\"27\">国产动漫</ty><ty id=\"28\">日韩动漫</ty><ty id=\"29\">欧美动漫</ty><ty id=\"30\">港台动漫</ty><ty id=\"31\">海外动漫</ty><ty id=\"32\">大陆综艺</ty><ty id=\"33\">港台综艺</ty><ty id=\"34\">日韩综艺</ty><ty id=\"35\">欧美综艺</ty><ty id=\"36\">海外综艺</ty><ty id=\"37\">犯罪片</ty><ty id=\"38\">伦理片</ty></class>'\n",
    "#过滤\n",
    "te = [int(s) for s in re.findall(r'\\b\\d+\\b', urt)]\n",
    "tr = re.findall('[\\u4e00-\\u9fa5]+', urt)\n",
    "#wpcm转换字典\n",
    "ty = dict(zip(tr,te))\n",
    "#结果\n",
    "resul= str(ty).replace(\" \",\"\").replace(\"':\",\",\").replace(\",'\",\"&&\").replace(\"'\",\"\")\n",
    "\n",
    "print(resul)\n",
    "## 输出后根据需要去除福利！！！\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ]
}